/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * @format
 * @flow
 */

import React,{Component} from 'react';
import {
    SafeAreaView,
    StyleSheet,
    ScrollView,
    View,
    Text,
    StatusBar, Button,
} from 'react-native';

import {
    Header,
    LearnMoreLinks,
    Colors,
    DebugInstructions,
    ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';
import NavigationUtil from "../navigator/NavigationUtil";

type Props = {};
export default class MyPage extends Component<Props>{
    render(){
        const {navigation} = this.props;
        return (
            <View style={styles.container}>
                <Text style={styles.welcome}>MyPage</Text>
                <Button
                    title="改变主题色"
                    onPress = {() => {
                        navigation.setParams({
                            theme: {
                                tintColor: 'green',
                                updateTime: new Date().getTime()
                            }
                        })
                    }}
                ></Button>
                <Text onPress={() => {
                    NavigationUtil.goPage({
                        navigation:this.props.navigation
                    },"DetailPage")
                }}>跳转到详情页</Text>
                <Button
                    title={'FetchDemo'}
                    onPress={() => {
                        NavigationUtil.goPage({
                            navigation:this.props.navigation
                        },"FetchDemoPage")
                    }}/>
                <Button
                    title={"DataStore"}
                    onPress={() => {
                        NavigationUtil.goPage({
                            navigation: this.props.navigation
                        },"DataStoreDemoPage")
                    }}
                ></Button>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: '#F5FCFF',
    },
    welcome: {
        fontSize: 20,
        textAlign: 'center',
        margin: 10,
    },
});

// export default App;
